package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.CommentsMapper;
import com.hello.system.domain.Comments;
import com.hello.system.service.ICommentsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户评论/动态Service业务层处理
 * 
 * @author hello
 * @date 2025-10-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class CommentsServiceImpl extends ServiceImpl<CommentsMapper, Comments> implements ICommentsService 
{
    private final CommentsMapper commentsMapper;

    /**
     * 查询用户评论/动态
     * 
     * @param commentId 用户评论/动态主键
     * @return 用户评论/动态
     */
    @Override
    public Comments selectCommentsByCommentId(Long commentId)
    {
        return commentsMapper.selectCommentsByCommentId(commentId);
    }

    /**
     * 查询用户评论/动态列表
     * 
     * @param comments 用户评论/动态
     * @return 用户评论/动态
     */
    @Override
    public List<Comments> selectCommentsList(Comments comments)
    {
        return commentsMapper.selectCommentsList(comments);
    }

    /**
     * 新增用户评论/动态
     * 
     * @param comments 用户评论/动态
     * @return 结果
     */
    @Override
    public int insertComments(Comments comments)
    {
        comments.setCreateTime(DateUtils.getNowDate());
        return commentsMapper.insertComments(comments);
    }

    /**
     * 修改用户评论/动态
     * 
     * @param comments 用户评论/动态
     * @return 结果
     */
    @Override
    public int updateComments(Comments comments)
    {
        comments.setUpdateTime(DateUtils.getNowDate());
        return commentsMapper.updateComments(comments);
    }


    /**
     * 批量删除用户评论/动态
     * 
     * @param commentIds 需要删除的用户评论/动态主键
     * @return 结果
     */
    @Override
    public int deleteCommentsByCommentIds(Long[] commentIds)
    {
        return commentsMapper.deleteCommentsByCommentIds(commentIds);
    }

    /**
     * 删除用户评论/动态信息
     * 
     * @param commentId 用户评论/动态主键
     * @return 结果
     */
    @Override
    public int deleteCommentsByCommentId(Long commentId)
    {
        return commentsMapper.deleteCommentsByCommentId(commentId);
    }
}
